package com.yidu.t299.dao.chr;

import com.yidu.t299.domain.chr.Class;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface ClassMapper {

    /**
     * 根据班级编号查询指定的信息
     * @param classId 班级编号
     * @return 班级对象
     */
    @Select({
        "select ",
        " class_id, class_name, class_type, startClass_time, startClass_num, classroom_id, ",
        " school_id, record_id, lesson_id",
        " from class",
        " where class_id = #{classId,jdbcType=INTEGER}"
    })
    @Results(id = "ClassMap" ,value={
        @Result(column="class_id", property="classId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="class_name", property="className", jdbcType=JdbcType.VARCHAR),
        @Result(column="class_type", property="classType", jdbcType=JdbcType.VARCHAR),
        @Result(column="startClass_time", property="startclassTime", jdbcType=JdbcType.VARCHAR),
        @Result(column="startClass_num", property="startclassNum", jdbcType=JdbcType.INTEGER),
        @Result(column="classroom_id", property="classroomId", jdbcType=JdbcType.INTEGER),
        @Result(column="school_id", property="schoolId", jdbcType=JdbcType.INTEGER),
        @Result(column="record_id", property="recordId", jdbcType=JdbcType.INTEGER),
        @Result(column="lesson_id", property="lessonId", jdbcType=JdbcType.INTEGER)
    })
    Class selectByPrimaryKey(Integer classId);

    @Select("select * from class")
    @ResultMap("ClassMap")
    List<Class> selectAll();
}